'use strict';

const Controller = require('egg').Controller;

class mjtiboughtit extends Controller {
  async index() {
    const data = await this.ctx.service.mjtiboughtit.findAll(this.ctx);
    this.ctx.body = data;
  }
  async create() {
    const ctx = this.ctx;
    const params = ctx.request.body;
    const data = await ctx.service.mjtiboughtit.create(params);
    ctx.body = data;
  }
  async destroy() {
    const ctx = this.ctx;
    const mjtiboughtitId = ctx.params.id;
    const del = await ctx.service.mjtiboughtit.delete(mjtiboughtitId);
    ctx.body = del;
  }
  async update() {
    const ctx = this.ctx;
    const mjtiboughtitId = ctx.params.id;
    const params = ctx.request.body;
    const change = await ctx.service.mjtiboughtit.update(mjtiboughtitId, params);
    ctx.body = change;
  }
  async show() {
    const ctx = this.ctx;
    const id = ctx.params.id;
    const mjtiboughtit = await this.ctx.service.mjtiboughtit.find(id);
    ctx.body = mjtiboughtit;
  }
  async index0() {
    const ctx = this.ctx;
    const shopState = ctx.params.shopState;
    console.log(shopState);
    const data = await this.ctx.service.mjtiboughtit.findAll0(shopState);
    this.ctx.body = data;
  }
  async index00() {
    const ctx = this.ctx;
    const userId = ctx.params.userId;
    console.log(userId);
    const data = await this.ctx.service.mjtiboughtit.findAll00(userId);
    this.ctx.body = data;
  }
}
module.exports = mjtiboughtit;
